package com.ruicar.afs.cloud.product.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruicar.afs.cloud.product.condition.ProductDiscountPlanCondition;
import com.ruicar.afs.cloud.product.entity.ProductDiscountPlan;
import com.ruicar.afs.cloud.product.mapper.ProductDiscountPlanMapper;
import com.ruicar.afs.cloud.product.service.ProductDiscountPlanService;
import com.ruicar.afs.cloud.product.vo.ExtrasInfoVo;
import com.ruicar.afs.cloud.product.vo.ProductDiscountPlanVo;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author yaorui.zhang
 * @date 2020年5月11日19:29:51
 */
@Service
public class ProductDiscountPlanServiceImpl extends ServiceImpl<ProductDiscountPlanMapper, ProductDiscountPlan> implements ProductDiscountPlanService {

    @Override
    public ProductDiscountPlan getProductDiscountPlanById(String id) {
        return this.baseMapper.selectOne(Wrappers.<ProductDiscountPlan>query().lambda().eq(ProductDiscountPlan::getId, id));
    }

    @Override
    public List<ExtrasInfoVo> getSelectDiscountShare() {
        return baseMapper.getSelectDiscountShare();
    }

    @Override
    public IPage<List<ProductDiscountPlanVo>> getListProductDiscountPlan(Page page, ProductDiscountPlanCondition condition) {
        return baseMapper.getListProductDiscountPlan(page, condition);
    }
}
